package structure;
import java.util.*;

public class Test5 {
    //蓝桥杯 判定括号序列(⭐)
    public static void main0(String[] args) {
        Scanner in = new Scanner(System.in);
        //在此输入您的代码...
        int len = in.nextInt();
        String str = in.next();
        int index = 0;
        char[] stack = new char[len + 5];
        char[] arr = str.toCharArray();
        for(int i = 0;i < arr.length;i++){
            char c = arr[i];
            switch(c){
                case '(':
                    index++;
                    stack[index] = c;
                    break;
                case ')':
                    if(index == 0 || stack[index] == ')'){
                        System.out.println("No");
                        return;
                    }
                    index--;
                    break;
            }
        }
        if(index == 0) {
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
        in.close();
    }
    //leetcode 622.设计循环队列
    class MyCircularQueue {
        public int left;
        public int right;
        public int[] elem;

        public MyCircularQueue(int k) {
            elem = new int[k + 1];
        }

        public boolean enQueue(int value) {
            if(isFull()){
                return false;
            }
            elem[right] = value;
            right = (right + 1) % elem.length;
            return true;
        }

        public boolean deQueue() {
            if(isEmpty()){
                return false;
            }
            elem[left] = 0;
            left = (left + 1) % elem.length;
            return true;
        }

        public int Front() {
            if(isEmpty()){
                return -1;
            }
            return elem[left];
        }

        public int Rear() {
            if(isEmpty()){
                return -1;
            }
            int index = (right == 0 ? elem.length - 1 : right - 1);
            return elem[index];
        }

        public boolean isEmpty() {
            return left == right;
        }

        public boolean isFull() {
            if((right + 1) % elem.length == left){
                return true;
            }
            return false;
        }
    }

}
